import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "login",
    component: () => import("../views/LoginView.vue"),
  },
  {
    path: "/index",
    name: "index",
    component: () => import("../views/IndexView.vue"),
    children: [
      {
        path: "/index",
        redirect: "/index/hot",
      },
      {
        path: "hot",
        name: "hot",
        component: () => import("../components/HotView.vue"),
      },
      {
        path: "new",
        name: "new",
        component: () => import("../components/NewView.vue"),
      },
      {
        path: "goods",
        name: "goods",
        component: () => import("../components/GoodsView.vue"),
      },
    ],
  },
  {
    path: "/class",
    name: "class",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/ClassifyView.vue"),
    children: [
      {
        path: "/class",
        redirect: "/class/dianqi",
      },
      {
        path: "dianqi",
        name: "dianqi",
        component: () => import("../components/DianqiPage.vue"),
      },
      {
        path: "phone",
        name: "phone",
        component: () => import("../components/PhonePage.vue"),
      },
      {
        path: "office",
        name: "office",
        component: () => import("../components/OfficePage.vue"),
      },
      {
        path: "cloth",
        name: "cloth",
        component: () => import("../components/ClothPage.vue"),
      },
      {
        path: "jiaju",
        name: "jiaju",
        component: () => import("../components/HomePage.vue"),
      },
    ],
  },
  {
    path: "/cart",
    name: "cart",
    component: () => import("../views/CartPage.vue"),
  },
  {
    path: "/my",
    name: "my",
    component: () => import("../views/MyView.vue"),
  },
  {
    path: "/one",
    name: "one",
    component: () => import("../components/PhoneOne.vue"),
  },
  {
    path: "/two",
    name: "two",
    component: () => import("../components/PhoneTwo.vue"),
  },
  {
    path: "/detail",
    name: "detail",
    component: () => import("../components/DetailOne.vue"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
